<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p>请选择你喜欢的水果（多选）</p>
    <input type="checkbox" name="fruit" value="苹果">苹果
    <input type="checkbox" name="fruit" value="香蕉">香蕉
    <input type="checkbox" name="fruit" value="西瓜">西瓜
</body>
</html>
<script>
    var  fruits=document.getElementsByTagName('fruit')
    console.log(fruits);
    console.log(fruits[1]);
</script>